@user.posts.where('status = ?', :unfinished).all returns []
        Posted  
        
            by Cheng
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Cheng
        
        
        
        Published on 2010-04-03T06:25:43Z
        Indexed on 
            2010/04/03
            6:33 UTC
        
        
        Read the original article
        Hit count: 325
        
activerecord
|ruby-on-rails3
By @user.posts, I can see there is a post with :unfinished status.
But @user.posts.where('status = ?', :unfinished).all returns an empty array.
I've tried to invoke @user.reload first, but it doesn't resolve the problem.
(rdb:568) @user.posts
[#<Post id: 1, content: "hehe", user_id: 1, created_at: "2010-04-03 06:16:47", updated_at: "2010-04-03 06:16:47", status: "--- :unfinished\n">]
(rdb:568) @user.posts.where('status = ?', :unfinished).all
[]
        © Stack Overflow or respective owner